<?php
namespace app\common\model;

use think\Model;
use think\model\concern\SoftDelete;

class InvestLog extends Model
{
	use SoftDelete;
    protected $deleteTime = 'delete_time';
    protected $defaultSoftDelete = 0;
    protected $autoWriteTimestamp = true;

    // public function getStatusAttr($value)
    // {   //0等待处理，1充值成功，2充值失败
    //     $status = [0=>'等待处理',1=>'充值成功',2=>'充值失败'];
    //     return $status[$value];
    // }

    protected function user()
    {
        return self::belongsTo(User::class, 'user_id')->bind(['user_name'=>'name','phone'=>'mobile']);
    }

    public static function getAdInvestLog($where = 0)
    {
    	return self::with('user')->whereOr($where)->order('create_time','DESC')->paginate();
    }

    public static function getInvestLogById($value)
    {
    	return self::with('user')->order('create_time','DESC')->find($value);
    }


}